use gloo_net::http::Request;
use wasm_bindgen_futures::spawn_local;
use web_sys::console;

pub fn delete_messages() {
    spawn_local(async move {
        match Request::delete("/api/messages").send().await {
            Ok(response) => {
                // Handle successful response
                console::log_1(&format!("Delete request successful: {:?}", response).into());
            }
            Err(e) => {
                // Handle error
                console::error_1(&format!("Error sending delete request: {:?}", e).into());
            }
        }
    });
}
